<template>
    <div id="loading">
        <van-loading color="#F53137" />
    </div>
</template>

<script>
    import { Toast } from 'vant';
    export default {
        props: [], // 父辈向子辈传参
        name: 'loading',
        components: { // 组件的引用

        },
        data() {
            return {

            }
        },
        methods: {
            getDetails() {
                this.$api.app.getEquipmentApi().then((res) => {
                    console.log("设备返回信息", res);
                    if (res.data) {
                        this.$store.commit('setDefaultEquipment', res.data)
                        this.$router.push('/index')
                        // this.$router.push('/bind')
                    } else {
                        this.$router.push('/bind')
                        // window.location.href = window.location.origin + '#/bind'
                    }
                }).catch((err) => {
                    Toast(err.message)
                });
            }
        },
        computed: {},
        watch: {},
        created() {
        },
        mounted() {
            this.getDetails()
        },
    }
</script>
    
<style scoped lang='scss'>
    #loading {
        background-color: #fff;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
</style>